package Month07.day09;

import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        String username = "admin";
        String password = "123456";
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名");
        for (int i = 1; i <= 3; i++) {
            String name = scanner.nextLine();
            System.out.println("请输入密码");
            String pass = scanner.nextLine();
            if (name.equals(username) && pass.equals(password)) {
                System.out.println("登陆成功");
                break;
            } else {
                if (i == 3) {
                    System.out.println("明天再来");
                } else {
                    System.out.println("登陆失败您还有" + (3 - i) + "次机会");
                }
            }
        }
    }
}
